package easy;
/*
191. 位1的个数
 */
public class LeeCode191 {

  public static void main(String[] args) {
    System.out.println(new LeeCode191().hammingWeight(11));
  }

  public int hammingWeight(int n) {
    int res = 0;
    while (n != 0){
      n = n & (n - 1);
      res++;
    }
    return res;
  }
}
